package com.example.library.controller;

import com.example.library.bean.model.Book;
import com.example.library.bean.model.User;
import com.example.library.bean.response.Response;
import com.example.library.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserAPI {

    @Autowired
    private UserService userService;

    @PostMapping("/register")
    public Response register(@RequestBody User user) {
        return userService.register(user);
    }

    @PostMapping("/update")
    public Response update(@RequestBody User user) {
        return userService.updateUser(user);
    }

    @GetMapping("/login")
    public Response login(String sno, String password) {
        return userService.login(sno, password);
    }

}
